import java.util.*;

public class UniqueWords {

	
	public static void main(String[] args) {
		
		String str=new String("my my book is my book not your book");
		
		String[] arrstr = str.split(" ");
		boolean unique;
		int x,ctr=1;	
				
	     for (x=0; x<arrstr.length; x++)
	     { 	 
	    	unique=true;
	    	 ctr=1;
	    	 
	    	 for(int y=0; y<arrstr.length; y++)
	    	 {
	    		 if(x!=y){
	    		 if (arrstr[x].equals(arrstr[y]))
	    		 {
	    			 if(y<x) {
							ctr=0;
							break;
	    		 }
	    			 unique=false;   			 
	    			 ctr++;
	    		 }
	    			 
	    		 } 		    		 
	    		
	    	 }
	    	 
	    	 if (ctr>1)
	 	    		System.out.println(arrstr[x] + " occurs " + ctr + " times ");
	    	 else if(ctr==1)
	    	 {
	    		 	System.out.print("unique words are:  ");
	    		 	System.out.println(arrstr[x]);
	    	 }
	    	
	  
	     }
	    
	}
	}


	
	